package sevensoft.创建型模式.单例模式.懒汉式.test;

import org.junit.Test;
import sevensoft.创建型模式.单例模式.懒汉式.Singleton3;

public class Demo {

    static Singleton3 singleton3_1;

    static Singleton3 getSingleton3_2;


    public static void main(String[] args) throws Exception {

        for ( int i = 0; i < 1000; i++ ) {
            final int index = i;
            new Thread(() -> {
                if ( index % 2 == 0 ) {
                    singleton3_1 = Singleton3.getInstance();
                    System.out.println(singleton3_1 == getSingleton3_2);
                } else {
                    getSingleton3_2 = Singleton3.getInstance();
                }
            }).start();
        }


//        Singleton3 instance = Singleton3.getInstance();
//        Singleton3 instance1 = Singleton3.getInstance();
//        System.out.println(instance == instance1);
//
//        System.out.println(instance1.hashCode());
//        System.out.println(instance1.hashCode());
    }


    @Test
    public void ass() {
        int x=15;
        final int MAX=7;
        double room=Math.ceil((double) x/MAX);
        System.out.println(room);
    }
}
